package com.hdsx.validator.util;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.springframework.util.ReflectionUtils;

public class HdReflectUtils extends ReflectionUtils {

	public static Field[] findFields(Class<?> clas)
	{
		Class<?> searchType = clas;
		List<Field> list=new ArrayList<Field>();
		while (!Object.class.equals(searchType) && searchType != null) {
			Field[] Decfields = searchType.getDeclaredFields();
			list.addAll(Arrays.asList(Decfields));
			searchType = searchType.getSuperclass();
		}
		return list.toArray(new Field[list.size()]);
	}
	public static String getInitial(String word)
	{
		if(word==null)
		{
			return null;
		}
		word=word.toLowerCase();
		String afertInitial=word.substring(0,1).toUpperCase();
		String afertStr="get"+afertInitial+word.substring(1);
		return afertStr;
	}
}
